function resv = diffParamMatrixSimple( pf, pm, ingConc, time )
%UNTITLED9 Summary of this function goes here
%   Detailed explanation goes here
    k = keys(pm);
    sz = size(k);
    nsz = sz(2);
    
    res = zeros(nsz, 1);
    for i = 1:nsz
        res(i) = diffByParamSimple(pf, pm, cell2mat(k(i)), ingConc, time);
    end
    
    fprintf('\n');

    resv = res;
end

function d = diffByParamSimple( pf, pm, pname, ingConc, time )
%pf - fixed params, pm - changing params, pname - name of varing param,
%ingconc - concentration of inhibitor, time - time at which diffirentiation
%occur

    pinfo = pm(pname);
    shift = min(10, (pinfo(3) - pinfo(2))/2 );       

    leftVal = pinfo(1) - shift;
    
    if abs(pinfo(1)) < 10*eps
        leftVal = 0;
    else
        if leftVal < -10*eps && pinfo(1) > 0
            shift = shift/10;
            leftVal = pinfo(1) - shift;
        end

        if leftVal < -10*eps && pinfo(1) > 0
            shift = shift/10;
            leftVal = pinfo(1) - shift;
        end
    end
    
    rightVal = pinfo(1) + shift;
        
    pStr2Double = defParamSet(pm);

    pStr2Double(pname) = leftVal;
    resParams = CalcResParams(pf, pStr2Double, ingConc);
    if abs(ingConc) < 10 * eps
        sol1 = NNsysExact_ing0(time, resParams);
    else
        sol1 = NNsysExact_ingNonzero(time, resParams);
    end
    lv = deval(sol1,time);
    
    pStr2Double(pname) = rightVal;
    resParams = CalcResParams(pf, pStr2Double, ingConc);
    if abs(ingConc) < 10 * eps
        sol2 = NNsysExact_ing0(time, resParams);
    else
        sol2 = NNsysExact_ingNonzero(time, resParams);
    end
    rv = deval(sol2,time);
    
    d = abs(rv(1) - lv(1));
    
    fprintf('%15s stepsize = %10f,  R0 comp = %12.12f\n', pname, 2*shift, d);
end

